package battlebarnserver.util;
/**
 *
 * @author johncreecy
 */
public class Conversions {

	public static int tileToPixel(int tile) {
		return (tile * Constants.PIXELS_PER_TILE);
	}

	public static int pixelToTile(int pixel) {
		return (pixel / Constants.PIXELS_PER_TILE);
	}

	public static String padCoordinate(String coordinate) {
		String paddedCoordinate = "";
		switch(coordinate.length()) {
			case 0: paddedCoordinate = "000"; break;
			case 1: paddedCoordinate = "00" + coordinate; break;
			case 2: paddedCoordinate = "0" + coordinate; break;
			default: paddedCoordinate = coordinate; break;
		}
		return paddedCoordinate;
	}

	public static void calculateMovement(int movementDirection) {
		//
	}

	public static int getBoundsX(int tileX) {
		if(tileX >= Constants.TILE_MAX_X){
			return Constants.TILE_MAX_X;
		} else if (tileX <= Constants.TILE_MIN_X) {
			return 0;
		} else {
			return tileX;
		}
	}

	public static int getBoundsY(int tileY) {
		if(tileY >= Constants.TILE_MAX_Y){
			return Constants.TILE_MAX_Y;
		} else if (tileY <= Constants.TILE_MIN_Y) {
			return 0;
		} else {
			return tileY;
		}
	}

}
